﻿using ImageDomain.DE;
using ScienceRpcServe.Protos;

namespace ScienceRpcServe.Utils;

public static class SplitServiceExtension
{
    public static SplitResponse ToSplitResponse(this ISplitDicomsDE sd)
    {
        var rs = new SplitResponse();

        foreach (var kp in sd.SplitSeriesDic)
        {
            rs.SplitInfos.Add(new SplitInfo()
            {
                PatientId = kp.Value.PatientId,
                PatientName = kp.Value.PatientName,
                StudyUid = kp.Value.StudyUid,
                StudyDescription = kp.Value.StudyDescription,
                SeriesDescription = kp.Value.SeriesDescription,
                SeriesTime = kp.Value.SeriesTime,
                Key = kp.Key,
                Dimension = kp.Value.Dimension,
                Width = kp.Value.Width,
                Height = kp.Value.Height,
                Count = kp.Value.Dicoms.Count
            });
        }

        return rs;
    }
}
